Skip to main content

Project Structure

BindAI projects provide a consistent way to organize agents, tools, workflows, knowledge, memory, templates, configuration, and tests. You can use BindAI components without creating a project, but a project provides a convenient structure for keeping an AI application organized as it grows.

Creating a Project

Create a new project with the BindAI CLI:
Move into the project:
The generated project provides a starting point for building a BindAI application. The project scaffold can evolve as BindAI’s CLI and templates develop, so the exact generated files may vary between versions.

Default Project Layout

A BindAI application can be organized around the following structure:
Not every application needs every directory. Each component should be introduced when the application requires it.

Project Files

main.py

main.py can serve as the application’s entry point. A simple application can create an agent and execute it:
The entry point can also start a larger application containing workflows, multiple agents, tools, or other BindAI components.

bindai.toml

bindai.toml is the project-level BindAI configuration file. It can be used to keep application configuration separate from Python source code. The exact configuration supported by a project depends on the BindAI version and the components being used. Keep secrets such as API keys out of bindai.toml. Use environment variables or another secure secret-management mechanism for credentials.

.env

The local .env file can contain environment variables required by the application. For example:
Other supported providers can use their corresponding environment variables:
Ollama generally uses a local model service rather than a hosted API key. Never commit API keys or other secrets to source control.

Agents

The agents/ directory can contain application-specific agent definitions. For example:
A simple agent can be defined with Agent.builder():
Larger applications can use multiple specialized agents. For example:
Each agent can have its own instructions, tools, memory, knowledge, retrieval configuration, and execution behavior.

Tools

The tools/ directory can contain reusable tools used by agents. For example:
A tool can be defined with the BindAI tool decorator:
The tool can then be supplied to an agent:
Tools can represent Python functions, APIs, application services, database operations, search functionality, external connections, or MCP-backed capabilities.

Workflows

The workflows/ directory can contain workflow-related application code. For example:
Workflows can coordinate:
  • Agents
  • Tools
  • Conditional execution
  • Loops
  • Parallel execution
  • Retries
  • Timeouts
  • Scheduling
  • Human tasks
Separating workflows from agents and tools makes larger applications easier to maintain. A workflow can also combine multiple specialized agents:

Knowledge

The knowledge/ directory can contain application resources used by knowledge and retrieval systems. For example:
Knowledge resources can be processed through BindAI’s knowledge and retrieval pipeline. The knowledge system supports capabilities including:
  • Document ingestion
  • Parsing
  • Chunking
  • Embeddings
  • Metadata
  • Semantic retrieval
  • BM25 retrieval
  • Hybrid retrieval
  • Filtering
  • Reranking
  • Conversational retrieval
  • Knowledge pipelines
Knowledge can then be connected to an agent:

Memory

The memory/ directory can be used to organize application-specific memory resources or implementations. BindAI provides several memory implementations, including:
  • In-memory memory
  • SQLite
  • PostgreSQL
  • Vector memory
  • Pinecone
  • Chroma
  • Conversation memory
  • Custom memory implementations
Memory can be configured for an agent:
The actual storage mechanism depends on the selected memory implementation.

Templates

The templates/ directory can contain reusable application or workflow templates. For example:
Templates can help teams standardize common application patterns. BindAI also provides workflow templates covering patterns such as:
  • Basic workflows
  • Conditions
  • Loops
  • Parallel execution
  • Human tasks
  • Retries
  • Timeouts
  • Scheduling

Tests

Store project tests inside the tests/ directory. For example:
Run the project’s tests with:
Tests should cover important application behavior, including agent execution, tool behavior, workflows, integrations, and other components used by the application.

Connections

Applications that communicate with external services can organize connection-related code separately from agents and workflows. BindAI’s Connections package currently provides integrations for:
  • Webhooks
  • GitHub
  • Slack
  • Notion
  • Jira
  • Discord
  • Resend
  • Vercel
  • Netlify
For example:
The exact organization is application-specific. Keeping external-service communication separate from agent logic makes integrations easier to test and replace.

MCP

Applications using Model Context Protocol can keep MCP-related configuration and integration code separate from core agent logic. BindAI’s current MCP support includes:
  • MCP client connections
  • Tool discovery
  • Tool calling
  • MCP tools exposed through the BindAI tool system
For example:
MCP resources and advanced protocol capabilities can be added as the MCP implementation expands.

Organizing Larger Projects

As an application grows, organize components by responsibility. For example:
This structure keeps responsibilities separated as the application becomes more complex.

Separating Responsibilities

A useful way to think about the project structure is:
Each layer has a focused responsibility while remaining composable with the others.

Multi-Agent Project Structure

Applications using multiple agents can organize specialists independently. For example:
The agents can then participate in delegation or team-based execution. A larger application might follow this pattern:
This organization works well when each agent has a clearly defined responsibility.

Environment and Source Control

Keep application secrets separate from source code. A typical project should include a .gitignore that excludes local environment files and other generated or sensitive content. For example:
Do not commit:
  • API keys
  • Access tokens
  • Passwords
  • Private credentials
  • Other sensitive configuration
The .env.example pattern can be used to document required environment variables without exposing their values.

Recommended Development Workflow

A typical BindAI project workflow is:
  1. Create a project with bindai new.
  2. Configure the project’s environment.
  3. Configure the required provider.
  4. Build agents inside agents/.
  5. Add reusable tools inside tools/.
  6. Add memory when persistent or conversational state is required.
  7. Add knowledge and retrieval when application-specific information is required.
  8. Add workflows when execution requires multiple coordinated steps.
  9. Add Connections when external services are required.
  10. Add MCP integrations when external MCP tools are required.
  11. Add templates for reusable application patterns.
  12. Write tests inside tests/.
  13. Run the application with the BindAI CLI.
The project structure is intentionally modular so an application can grow from a simple assistant into a larger AI system without placing all of its logic in a single module.

Minimal Project

Not every project needs the complete structure. A small application can start with only:
As requirements grow, additional directories can be introduced:
This allows projects to remain simple at the beginning while still providing a path toward larger AI applications.

Next Steps

After understanding the project structure, continue with: